clear
set mem 500m
set more off

use "2000 NHIS RELEVANT.dta"

drop if age_p<18

drop if smkev==.

su wtia if smkev~=2
global mean = r(mean)
replace wtia=wtia/$mean

gen region1=.
replace region1=1 if region==1 & smkev~=2
replace region1=2 if region==2 & smkev~=2
replace region1=3 if region==3 & smkev~=2
replace region1=4 if region==4 & smkev~=2
label var region1 "region - without neversmokers"

label define regionl 1 "northeast" 2 "midwest" 3 "south" 4 "west"

label values region1 regionl

gen racerpi1=.
replace racerpi1=1 if racerp_i==1 & smkev~=2
replace racerpi1=2 if racerp_i~=1 & smkev~=2
label variable racerpi1 "race - without neversmokers"

label define racerpil 1 "white only" 2 "other"
label values racerpi1 racerpil

gen hispan1=.
replace hispan1=1 if origin_i==1 & smkev~=2
replace hispan1=2 if origin_i==2 & smkev~=2
label variable hispan1 "ethnicity - without neversmokers"

label define hispanl 1 "hispanic/latino" 2 "not hispanic/latino"

label values hispan1 hispanl

gen agecats=.
replace agecats=1 if age_p>=18 & age_p<=25 & smkev~=2
replace agecats=2 if age_p>25 & age_p<=35 & smkev~=2
replace agecats=3 if age_p>35 & age_p<=45 & smkev~=2
replace agecats=4 if age_p>45 & age_p<=55 & smkev~=2
replace agecats=5 if age_p>55 & age_p<=65 & smkev~=2
replace agecats=6 if age_p>65 & smkev~=2
label var agecats "age - without neversmokers"

label define agecatsl 0 "under 18" 1 "18-24" 2 "25-34" 3 "35-44" 4 "45-54" 5 "55-64" 6 "65+"

label values agecats agecatsl

gen sex1=.
replace sex1=1 if sex==1 & smkev~=2
replace sex1=2 if sex==2 & smkev~=2
replace sex1=. if smkev==2
label variable sex1 "sex - without neversmokers"

label define sexl 1 "male" 2 "female"

label values sex1 sexl

gen educ1=.
replace educ1=1 if educ<13 & smkev~=2
replace educ1=2 if educ>=13 & educ<15 & smkev~=2
replace educ1=3 if educ>=15 & educ<17 & smkev~=2
replace educ1=4 if educ>=17 & educ<19 & smkev~=2
replace educ1=5 if educ>=19 & educ<22 & smkev~=2
replace educ1=. if educ>=97 & educ<100 & smkev~=2
label variable educ1 "educ - without neversmokers"

label define educl 1 "less than high school" 2 "high school graduate" 3 "some college" 4 "college graduate" 5 "graduate degree"

label values educ1 educl

gen racebroad=.
replace racebroad=1 if racerp_i==1
replace racebroad=2 if racerp_i==2
replace racebroad=3 if racerp_i>2

***note: occupational/tech associate's degrees go with "some college", academic associate's degree goes with "college graduate"

***following commands generate necessary tables:

tab sex1 [aw=wtia]
tab agecats [aw=wtia]
tab educ1 [aw=wtia]
tab racerpi1 [aw=wtia]
tab hispan1 [aw=wtia]
tab region1 [aw=wtia]
